<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" >
</body>
<script>
    //onketdown ,onkeypress键盘按下事件
    let input=document.querySelector('input')
    input.onkeydown=function(event){
        // console.log("键盘正在按下")
        // let a=event.keyCode;
        // console.log(a)
        // let b =String.fromCharCode(a)
        // console.log(b)
        if(event.shiftKey){
            alert("shift")
        }
        if(event.altKey){
            alert("Alt")
        }

    }
    //onkeypress:键盘按下字母区分大小写
    // input.onkeypress=function(event){
    //     console.log("键盘正在按下")
    //     let a=event.keyCode;
    //     console.log(a)
    //     let b =String.fromCharCode(a)
    //     console.log(b)
        

    // }
    //onkeyup键盘抬起事件
    input.onkeyup=function(){
        console.log("键盘被抬起")
    }
     
</script>
</html>